<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

	<link rel="stylesheet" type="text/css" href="${basePath }/css/news.css" />
	<style>
	.custom_page{ padding: 9px 15px; border: 1px solid #e4eaec; border-right: none; background: #fff; text-align: center; color: #76838f; }
	.custom_page:hover { background: #f5f5f5; text-decoration: none; }
	</style>
	
	<div class="subcolumn_nav_met_16_1      border-bottom1" m-id='34'
		m-type='nocontent'>
		<div class="">
			<c:if test="${!empty menuList or !empty type }">
			<div class="subcolumn-nav text-xs-center">
				<ul class="subcolumn_nav_met_16_1-ul m-b-0 p-y-10 p-x-0 ulstyle">
					<c:if test="${type eq all }">
						<c:set var="allActive" value="active" />
					</c:if>
					<li><a href="${basePath}/${all}?all=${all}"
						title="全部" class="${allActive }">全部</a></li>
					<c:forEach items="${menuList }" var="menu">
						<c:choose>
						<c:when test="${menu.key eq type }">
							<li><a href="${basePath}/${menu.key}?all=${all}"
								title="${menu.showName }" class='active'>${menu.showName }</a></li>
						</c:when>
						<c:otherwise>
							<li><a href="${basePath}/${menu.key}?all=${all}"
								title="${menu.showName }">${menu.showName }</a></li>
						</c:otherwise>
						</c:choose>
					</c:forEach>
				</ul>
			</div>
			</c:if>
		</div>
	</div>
	
	<main class="news_list_page_met_28_1 met-news">
	<div class="container">
		<div class="row">
			<div class="col-md-9 met-news-body     fl_left">
				<div class="row     paddingR">
					<div class="met-news-list">
						<ul class="ulstyle met-pager-ajax imagesize" data-scale='260x380' id="main-ul"
							m-id='39'>
							<%@ include file="/WEB-INF/jsp/listAppend.jsp"%>
						</ul>
						<div class='m-t-20 text-xs-center hidden-sm-down' m-type="nosysdata">
							<div class="met_pager">
								<form id="pageForm" action="${basePath }/${type}?all=${all}" method="post">
									<input type="hidden" name="pageNum" value="${page.current}" />
									<input type="hidden" name=keyword value="${keyword }" />
									<input type="hidden" name="pages" value="${page.pages}" />
									<input type="hidden" name="total" value="${page.total}" />
								</form>
									<c:if test="${page.pages>1}">
										<li>
											第<input type="number" min="1" class="custom_page" style="width: 65px;text-align:center;display: inline-block;" id="num" value="${page.current}">页
										</li>
										<li>
											<a href="javascript:void(0);" onclick="jump();">跳</a>
										</li>
										<li>
											<a href='javascript:_this._ajaxList(1)'>首页</a>
										</li>
									</c:if>
									<c:if test="${page.current>1}">
										<li>
											<a href='javascript:_this._ajaxList(${page.current-1})' class='PreA'>上一页</a>
										</li>
									</c:if>
									<c:if test="${page.current <= 1}">
										<li>
											<span href='javascript:_this._ajaxList(1)' class='PreSpan'>上一页</span>
										</li>
									</c:if>
									<c:if test="${page.current<page.pages}">
										<li>
											<a href='javascript:_this._ajaxList(${page.current+1})' class='NextA'>下一页</a>
										</li>
									</c:if>
									<c:if test="${page.current >= page.pages}">
										<li>
											<span href='javascript:_this._ajaxList(${page.current})' class='NextSpan'>下一页</span>
										</li>
									</c:if>
									<c:if test="${page.current<page.pages}">
										<li>
											<a href='javascript:_this._ajaxList(${page.pages})' class='NextA'>尾页</a>
										</li>
									</c:if>
									<c:if test="${page.current == page.pages}">
										<li>
											<span href='javascript:_this._ajaxList(${page.current})' class='NextSpan'>尾页</span>
										</li>
									</c:if>
							</div>
						</div>
						<script type="text/javascript">
						var _this = {
							_ajaxList : function(pageNum){
								pageForm.pageNum.value = pageNum;
								pageForm.submit();
							}
						}
						var mobileMore = function(){
							var replaceClass = "btn btn-primary btn-block btn-squared ladda-button disabled";
							var iReplaceClass = "fa fa-spinner fa-spin fa-2x fa-fw";
							var $btn = $("#met-pager-btn");
							var $class = $btn.attr("class");
							var $iClass = $btn.find("i").attr("class");
							
							if($btn.hasClass("disabled")){
								return;
							}
							var pageNum = pageForm.pageNum.value;
							pageNum = parseInt(pageNum) + 1;
							if(pageNum > ${page.pages} || pageNum <= 1){
								return;
							}
							var keyword = pageForm.keyword.value;
							$btn.attr("class",replaceClass);
							$btn.find("i").attr("class",iReplaceClass);
							$.ajax({
								url : '${basePath}/mobile/${type}',
								data : {pageNum : pageNum,keyword :keyword},
								dataType : 'html',
								method : "post",
								success : function(data){
									$btn.attr("class",$class);
									$btn.find("i").attr("class",$iClass);
									$("#main-ul").append(data);
									pageForm.pageNum.value = pageNum;
									if(pageNum == ${page.pages}){
										$btn.attr("class",replaceClass);
										$btn.html("已经是最后一页了");
									}
								},
								error : function(data){
									$btn.attr("class",$class);
									$btn.find("i").attr("class",$iClass);
								}
							});
						}
						var jump = function(){
							var num = $('#num').val();
							if(num==""||isNaN(num)||num<=0){
								layer.alert("请输入正确的页码");
								return;
							}
							num = parseInt(num);
							var total = parseInt("${page.pages}");
							if(num<0||num>total){
								_this._ajaxList('1');
							}else{
								_this._ajaxList(num);
							}
						}
						</script>
						
						<div class="met_pager met-pager-ajax-link hidden-md-up"
							data-plugin="appear" data-animate="slide-bottom"
							data-repeat="false" m-type="nosysdata">
							<button type="button" onclick="mobileMore()"
								class="btn btn-primary btn-block btn-squared ladda-button"
								id="met-pager-btn" data-plugin="ladda" data-style="slide-left"
								data-url="" data-page="1">
								<i class="icon wb-chevron-down m-r-5" aria-hidden="true"></i>

							</button>
						</div>
					</div>
				</div>
			</div>

			<%@ include file="/WEB-INF/jsp/articleLeft.jsp"%>
		</div>
	</div>
	</main>